package com.example.demo.test;

import com.alibaba.fastjson.JSONObject;

import javax.swing.text.Style;
import java.util.*;
import java.util.stream.Collectors;

public class test2 {

    public static void main(String[] args) {
        String str="{    \"code\": \"0\",    \"message\": \"成功\",    \"data\": {        \"111360\": {            \"attrId\": \"111360\",            \"time\": \"1659317933392\",            \"value\": \"36.0\"        },        \"111361\": {            \"attrId\": \"111361\",            \"time\": \"1659317933392\",            \"value\": \"36\"        },        \"111363\": {            \"attrId\": \"111363\",            \"time\": \"1659317933392\",            \"value\": \"36\"        }    }}";

        Map jsonObject = JSONObject.parseObject(str);
        System.out.println(jsonObject);
        System.out.println(jsonObject.get("data"));
        Map data = (Map) jsonObject.get("data");
        System.out.println(data.get("111363"));
        Set set = data.keySet();
        System.out.println(set);
        set.forEach(key->{
            System.out.println(key+"----"+data.get(key));
        });
        Map o = (Map) data.get("111363");
        System.out.println(o.get("value"));


        /*List<String> list = new ArrayList<>();
        list.add("1231321");
        list.add("213");
        list.add("675");
        List<String> collect = list.stream().collect(Collectors.toList());
        String[] strings = collect.toArray(new String[collect.size()]);
        System.out.println(Arrays.toString(strings));*/

    }
}
